package com.IoLiu;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;

public class CoStudent {
    public static void main(String[] args) throws IOException {
        list();
    }

    private static void list() throws IOException {
        BufferedReader br=new BufferedReader(new
                FileReader("D:\\下载\\file\\file1\\student.txt"));
        ArrayList<Student> list=new ArrayList<Student>();
        String line;
        while((line=br.readLine())!=null){
            Student stu=new Student();
            String[] sarr=line.split(",");
            stu.setSid(sarr[1]);
            stu.setName(sarr[0]);
            stu.setAddress(sarr[2]);
            stu.setAge(Integer.parseInt(sarr[3]));
            list.add(stu);
        }
        br.close();
        for (Student stu:list) {
            System.out.println("姓名:"+stu.getName()+",学号:"+stu.getSid()+",年龄:"+stu.getAge()+",地址:"+stu.getAddress());
        }
    }
}
